/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.easoft.code.pos.ui.beans;

import com.easoft.code.pos.ui.controls.ButtonMenu;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Eliu
 */
public class FormDataEntryManager extends javax.swing.JPanel {

    private List<FormDataEntry> dataEntries = new LinkedList<>();
    private String defaultImageMenu;

    /**
     * Creates new form FormDataEntryMan
     *
     * @param de
     * @param defImageMenu
     */
    public FormDataEntryManager(List<FormDataEntry> de, String defImageMenu) {
        initComponents();
        this.dataEntries = de;
        this.defaultImageMenu = defImageMenu;
        loadEntriesMenu();
    }

    /**
     * Creates new form FormDataEntryMan
     */
    public FormDataEntryManager() {
        initComponents();
    }

    public String getDefaultImageMenu() {
        return defaultImageMenu;
    }

    public void setDefaultImageMenu(String defaultImageMenu) {
        this.defaultImageMenu = defaultImageMenu;
    }

    private void loadEntriesMenu() {
        dataEntryMenu.removeAll();
        for (FormDataEntry de : dataEntries) {
            dataEntryMenu.add(new ButtonMenu(de.getMenuName(),
                    defaultImageMenu, dataEntryArea, de));
        }
    }

    public List<FormDataEntry> getDataEntries() {
        return dataEntries;
    }

    public void setDataEntries(List<FormDataEntry> dataEntries) {
        this.dataEntries = dataEntries;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        dataEntryMenu = new javax.swing.JPanel();
        dataEntryArea = new javax.swing.JPanel();

        setLayout(new java.awt.BorderLayout());

        dataEntryMenu.setPreferredSize(new java.awt.Dimension(702, 150));
        dataEntryMenu.setLayout(new java.awt.GridLayout(2, 0));
        add(dataEntryMenu, java.awt.BorderLayout.PAGE_START);

        dataEntryArea.setLayout(new java.awt.BorderLayout());
        add(dataEntryArea, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel dataEntryArea;
    private javax.swing.JPanel dataEntryMenu;
    // End of variables declaration//GEN-END:variables
}
